package thread.join;

public class SumThread extends Thread{
	private int startNo;
	private int endNo;
	private int sum;
	
	
	
	public SumThread(int startNo, int endNo) {
		super();
		this.startNo = startNo;
		this.endNo = endNo;
	}
	
	public int getSum(){
		return sum;
	}



	public void run(){
		//startNo 에서 endNo까지 1씩 누적(더하기)해서 sum에 저장.
		//s : 1, e : 5 - sum = 1+2+3+4+5
		
		for(int i = startNo; i<= endNo; i++){
			sum += i;
		}
	}

}
